﻿using System;

namespace KWatkins.FluentMoqBuilder.Argument
{
	internal sealed class DateTimeValidation : ArgumentValidation<DateTime>, IDateTime
	{
		internal DateTimeValidation(DateTime argument, string parameterName)
			: base(argument, parameterName)
		{
		}

		#region IDateTime Members
		IDateTime IDateTime.IsAfter(DateTime minimum)
		{
			if (Argument <= minimum)
			{
				throw new ArgumentOutOfRangeException(ParameterName, Argument, string.Concat("Value must be after ", minimum, "."));
			}
			return this;
		}

		IDateTime IDateTime.IsAfterOrTheSame(DateTime minimum)
		{
			if (Argument < minimum)
			{
				throw new ArgumentOutOfRangeException(ParameterName, Argument, string.Concat("Value must be after or the same as ", minimum, "."));
			}
			return this;
		}

		IDateTime IDateTime.IsBefore(DateTime maximum)
		{
			if (Argument >= maximum)
			{
				throw new ArgumentOutOfRangeException(ParameterName, Argument, string.Concat("Value must be before ", maximum, "."));
			}
			return this;
		}

		IDateTime IDateTime.IsBeforeOrTheSame(DateTime maximum)
		{
			if (Argument > maximum)
			{
				throw new ArgumentOutOfRangeException(ParameterName, Argument, string.Concat("Value must be before or the same as ", maximum, "."));
			}
			return this;
		}
		#endregion
	}
}
